﻿using S2Cloud.SmartFlow.GrpcHelper;
using System.Collections.Generic;

namespace S2_Xxxx_XxxNetApi
{
    /// <summary>
    /// 用户操作帮助类
    /// </summary>
    public class UserHelper
    {
        /// <summary>
        /// 获取用户信息
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <returns></returns>
        public static dynamic GetUserInfo(string userId)
        {
            return GrpcClientSingle.S2GrpcClient.userManager.GetUserInfo(userId);
        }

        /// <summary>
        /// 验证权限是否存在
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="appfunctionitemcode">功能code</param>
        /// <returns></returns>
        public static dynamic CheckFunctionItem(string userId, string appfunctionitemcode)
        {
            return GrpcClientSingle.S2GrpcClient.userManager.CheckFunctionItem(userId, appfunctionitemcode);
        }

        /// <summary>
        /// 将一个或多个用户调整部门
        /// </summary>
        /// <param name="UserList">人员集(逗号分隔)</param>
        /// <param name="DeptId">部门Id</param>
        /// <returns></returns>
        public static dynamic MoveUserToNewDept(string userId, string deptId)
        {
            return true;
        }

        /// <summary>
        /// 根据部门Code或Id获取部门下的人员
        /// </summary>
        /// <param name="DeptId">部门Id</param>
        /// <returns></returns>
        public static dynamic GetDeptUser(string DeptId)
        {
            return new { UserList = new List<string>() };
        }

        /// <summary>
        /// 根据部门code或ID获取所有子部门，并根据父子管理排序
        /// </summary>
        /// <param name="DeptId">部门Id</param>
        /// <returns></returns>
        public static dynamic GetChildDept(string deptId)
        {
            return new { UserList = new List<string>() };
        }

        /// <summary>
        /// 根据角色名称或code查找角色里的人员集合
        /// </summary>
        /// <param name="roleId">角色Id</param>
        /// <returns></returns>
        public static dynamic GetUserByRoleId(string roleId)
        {
            return new { UserList = new List<string>() };
        }

        /// <summary>
        /// 修改角色里的某个人员
        /// </summary>
        /// <param name="roleId">角色Id</param>
        /// <param name="userId">原用户Id</param>
        /// <param name="newUserId">新用户Id</param>
        /// <returns></returns>
        public static dynamic UpdateRoleUserId(string roleId,string userId,string newUserId)
        {
            return true;
        }

        /// <summary>
        /// 给某个角色增加人员
        /// </summary>
        /// <param name="UserList">人员集合</param>
        /// <param name="DeptId">部门Id</param>
        /// <returns></returns>
        public static dynamic AddUserToRole(string userId, string roleId)
        {
            return true;
        }

        /// <summary>
        ///删除角色里的一个或多个人员
        /// </summary>
        /// <param name="roleId">角色Id</param>
        /// <param name="userId">用户ID集合（逗号分隔）</param>
        /// <returns></returns>
        public static dynamic DelUserFromRole(string roleId, string userId)
        {
            return true;
        }

        /// <summary>
        ///查找某个用户是否在指定的角色里
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="roleId">角色Id</param>
        /// <returns></returns>
        public static dynamic FindUserFromRoleId(string userId, string roleId)
        {
            return true;
        }

        /// <summary>
        /// 根据组名称或code查找组里的人员集合
        /// </summary>
        /// <param name="groupId">组Id</param>
        /// <returns></returns>
        public static dynamic GetUserByGroupId(string groupId)
        {
            return true;
        }

        /// <summary>
        /// 修改组里的某个人员
        /// </summary>
        /// <param name="userId">人员集合</param>
        /// <param name="newUserId">部门Id</param>
        /// <param name="groupId">组Id</param>
        /// <returns></returns>
        public static dynamic UpdateGroupUserId(string userId, string newUserId, string groupId)
        {
            return true;
        }

        /// <summary>
        /// 赋值给某个组的人员
        /// </summary>
        /// <param name="roleId">角色Id</param>
        /// <param name="groupId">组Id</param>
        /// <returns></returns>
        public static dynamic AddUserToGroup(string roleId, string groupId)
        {
            return true;
        }

        /// <summary>
        /// 删除组里的一个或多个人员
        /// </summary>
        /// <param name="UserList">人员集合</param>
        /// <param name="groupId">组Id</param>
        /// <returns></returns>
        public static dynamic DelUserFromGroup(List<string> UserList, string groupId)
        {
            return true;
        }

        /// <summary>
        /// 查找某个用户是否在指定的组里
        /// </summary>
        /// <param name="userId">人员Id</param>
        /// <param name="groupId">组Id</param>
        /// <returns></returns>
        public static dynamic FindUserFromGroupId(string userId, string groupId)
        {
            return true;
        }
    }
}
